package net.kesumu.yushabu.utils;

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.text.Layout;
import android.util.AttributeSet;
import android.util.DisplayMetrics;

public class YushabuMessagingGLSurfaceView extends GLSurfaceView{
    
    int firstWidth = -1;
    int firstHeight = -1;
    
    public final Context context;
    
    //programmatic instantiation
    public YushabuMessagingGLSurfaceView(Context context)
    {
        this(context, null);
    }

    //XML inflation/instantiation
    public YushabuMessagingGLSurfaceView(Context context, AttributeSet attrs)
    {
        this(context, attrs, 0);
    }

    public YushabuMessagingGLSurfaceView(Context context, AttributeSet attrs, int defStyle)
    {
        super(context, attrs);
        this.context = context;

//        // Tell EGL to use a ES 2.0 Context
//        setEGLContextClientVersion(2);
//
//        // Set the renderer
//        setRenderer(new YushabuMessagingGLRenderer(context));
    }
    
    //cancel the resize
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        android.view.ViewGroup.LayoutParams layoutParams = this.getLayoutParams();
        if (layoutParams != null) {

            if (firstWidth == -1)
                firstWidth = getMeasuredWidth();
            if (firstHeight == -1)
                firstHeight = getMeasuredHeight();

            setMeasuredDimension(firstWidth, firstHeight);
        }
    }

}
